﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    API 测试控制台
</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        你好,<%= Html.Encode(ViewData["Message"]) %></h2>
    <h3>
        方法:</h3>
    <form action="/Admin/getAllocation" method="post" id="methodsform">
    <select name="method" class="method">
        <option value="/Admin/getAllocation" selected="selected">admin.getAllocation</option>
        <option value="/Friends/get">friends.get</option>
        <option value="/friends/areFriends" rel="arg_friends">friends.areFriends</option>
        <option value="/friends/getFriends">friends.getFriends</option>
        <option value="/friends/getAppUsers">friends.getAppUsers</option>
        <option value="/friends/getAppFriends">friends.getAppFriends</option>
        <option value="/user/getInfo">user.getInfo</option>
        <option value="/user/getLoggedInUser">user.getLoggedInUser</option>
        <option value="/Notifications/Send"  rel="arg_send">Notifications.Send</option>
        <option value="/Notifications/SendEmail"  rel="arg_sendemail">Notifications.SendEmail</option>
    </select>
    <div id="arg_friends" class="hide">
        <label>
            用户IDs，逗号区隔</label><input type="text" name="uids" />
        <label>
            用户IDs2，逗号区隔</label><input type="text" name="uids2" />
    </div>
    <div id="arg_send" class="hide">
        消息<textarea name="Notifications" rows="6" cols="50">hello,<xn:name uid="258187801" linked="true"/> ，去看看这部电影<a href="http://www.tudou.com/programs/view/Tzpw9PIj8zM/">狮子王</a></textarea>
    </div>
    <div id="arg_sendemail" class="hide">
        接收者<input type="text" name="recipients" />
        模板ID<input type="text" name="template_id" />
        消息<textarea name="body_data" rows="6" cols="50">hello,<xn:name uid="258187801" linked="true"/> ，去看看这部电影<a href="http://www.tudou.com/programs/view/Tzpw9PIj8zM/">狮子王</a></textarea>
    </div>
    <input type="submit" class="submit" value="调用" />
    </form>
    <div id="result" style="border: solid 1px #666; margin: 10px 0; height: 420px; background-color: #ccc;">
    </div>

    <script language="javascript" type="text/javascript">
        jQuery(document).ready(function() {
            $("select.method").change(function(e) {
                $("form div").hide();
                $('#methodsform').attr("action", $(this).val());
                if ($(this).find("option[selected]").attr("rel") != "") {
                    $("#" + $(this).find("option[selected]").attr("rel")).show();
                }
            });

            $('#methodsform').ajaxForm({
                target: '#result'
            });
        });
    </script>

</asp:Content>
